<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>首页 - 光年(Light Year Admin V4)后台管理系统模板</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V4是一个后台管理系统的HTML模板，基于Bootstrap v4.4.1。">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet" th:href="@{/css/bootstrap.min.css}" >
<link href="css/materialdesignicons.min.css" rel="stylesheet" th:href="@{/css/materialdesignicons.min.css}">
<link href="css/style.min.css" rel="stylesheet" th:href="@{/css/style.min.css}">
</head>
  
<body>
<div class="row no-gutters bg-white vh-100">
  <div class="col-md-6 col-lg-7 col-xl-8 d-none d-md-block" style="background-image: url(images/login-bg-1.jpg); background-size: cover;">

    <div class="d-flex vh-100">
      <div class="p-5 align-self-end">
        <img src="images/logo-sg.png" th:src="@{/images/logo-sg.png}" alt="...">
        <br><br><br>
        <p class="text-white">Light Year Admin V4是一个后台管理系统的HTML模板，基于Bootstrap v4.4.1。</p>
      </div>
    </div>

  </div>

  <div class="col-md-6 col-lg-5 col-xl-4 align-self-center">
    <div class="p-5">
      <div class="text-center">
        <a href="index.html"> <img alt="light year admin" src="images/logo-sidebar.png" th:src="@{/images/logo-sidebar-sg.png}"> </a>
      </div>
      <p class="text-center text-muted"><small>请使用您的账号登录系统</small></p>

      <form action="#!" method="post">
        <div class="form-group">
          <label for="username">用户名</label>
          <input type="text" class="form-control" id="username" placeholder="请输入您的用户名">
        </div>

        <div class="form-group">
          <label for="password">密码</label>
          <input type="password" class="form-control" id="password" placeholder="请输入您的密码">
        </div>

        <div class="form-group">
          <div class="custom-control custom-checkbox">
            <input type="checkbox" class="custom-control-input" id="rememberme">
            <label class="custom-control-label not-user-select" for="rememberme">5天内自动登录</label>
          </div>
        </div>

        <div class="form-group">
          <button class="btn btn-block btn-primary" type="submit" onclick="submit">立即登录</button>
        </div>
      </form>
      <p class="text-center text-muted mt-3">SSM <a href="#">分布式架构</a>. </p>
    </div>
  </div>
</div>

<script type="text/javascript" src="js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
<script type="text/javascript">
  /* 后面加入改变背景图 */

  function submit(){
    $.ajax({
      //几个参数需要注意一下
      type: "POST",//方法类型
      dataType: "json",//预期服务器返回的数据类型
      url: "/users/login" ,//url
      data: $('#form1').serialize(),
      success: function (result) {
        console.log(result);//打印服务端返回的数据(调试用)
        if (result.resultCode == 200) {
          alert("SUCCESS");
        }
        ;
      },
      error : function() {
        alert("异常！");
      }
    });
  }


</script>
</body>
</html>